package com.example.module_vip.vip.viewmodel

import android.util.Log
import androidx.lifecycle.MutableLiveData
import com.example.lib_common.base.BaseViewModel
import com.example.module_vip.vip.AppointmentsList
import com.example.module_vip.vip.AppointmentsListItem
import com.example.module_vip.vip.VipRePo
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class VipViewModel @Inject constructor(private val vipRePo: VipRePo) :
    BaseViewModel() {
    val viplivedata by lazy {
        MutableLiveData<AppointmentsList>()
    }

    fun getappintmentslist() {
        execute(
            action = vipRePo.getappointmentslist(),
            onFinish = {
                viplivedata.value =   it.data
            },
            onError = {

            }
        )
    }


    // 创建预约
    fun createappointment(body: AppointmentsListItem) {
        execute(
            action = vipRePo.createappointment(body),
            onFinish = {
                Log.d("创建预约", "创建预约成功")
            },
            onError = {
                Log.d("创建预约", "创建预约失败")
            }
        )
    }



}